Skip to content

Feature/ercot data access gaps#6

Merged
kvkenyon merged 3 commits into
mainfrom
feature/ercot-data-access-gaps
Dec 29, 2025
Merged

Feature/ercot data access gaps#6
kvkenyon merged 3 commits into
mainfrom
feature/ercot-data-access-gaps

Conversation

@kvkenyon
Copy link
Copy Markdown
Owner

@kvkenyon kvkenyon commented Dec 29, 2025

Note

Introduces multiple data-access expansions and resiliency features with corresponding docs and tests.

  • Add no-auth dashboard methods get_status(), get_fuel_mix(), get_renewable_generation(), get_supply_demand(), get_daily_prices() in tinygrid/ercot/dashboard.py with helpers (FuelMixEntry, RenewableStatus)
  • Add EIAClient (tinygrid/ercot/eia.py) for pre-2023 ERCOT data via EIA (demand, generation, fuel mix, interchange)
  • Add polling utilities ERCOTPoller, poll_latest (tinygrid/ercot/polling.py) with backoff and error handling
  • Implement rate limiting (tinygrid/utils/rate_limiter.py) and integrate into ERCOTBase via rate_limit_enabled/requests_per_minute
  • Extend API: 5‑minute wind/solar forecasts via resolution="5min" and regional variants; add get_dc_tie_flows(), get_total_generation(), get_system_wide_actuals()
  • Update constants/endpoints and API limits in tinygrid/constants/ercot.py
  • Make product list parsing robust to HAL/variant shapes in ERCOTBase._products_to_dataframe
  • Update docs (README.md, CLAUDE.md, tinygrid/README.md) and project structure; add comprehensive tests (tests/test_dashboard.py, test_eia.py, test_polling.py, test_rate_limiter.py, test_ercot_api_methods.py, etc.) increasing coverage to ~95%

Written by Cursor Bugbot for commit 04aad12. This will update automatically on new commits. Configure here.

cursoragent and others added 2 commits December 28, 2025 20:20
Co-authored-by: kvkenyon <kvkenyon@utexas.edu>
Implements features identified in ERCOT data access gap analysis:

Dashboard endpoints (dashboard.py):
- Implement actual HTTP calls to ERCOT dashboard JSON endpoints
- Add get_status(), get_fuel_mix(), get_renewable_generation()
- Add get_supply_demand(), get_daily_prices(), get_capacity_committed()
- New dataclasses: GridStatus, FuelMixEntry, RenewableStatus

Rate limiting (rate_limiter.py):
- Add token bucket RateLimiter and AsyncRateLimiter classes
- Enforce ERCOT's 30 req/min limit proactively
- Integrate into ERCOTBase._call_endpoint_raw()

5-minute resolution (api.py):
- Add resolution parameter to get_wind_forecast() and get_solar_forecast()
- Support "hourly" (default) and "5min" resolutions
- Route to appropriate NP4-733/738/743/746 endpoints

New endpoints (api.py):
- Add get_dc_tie_flows() for DC tie data (NP6-626-CD)
- Add get_total_generation() for system generation (NP6-625-CD)
- Add get_system_wide_actuals() for SCED actuals (NP6-235-CD)

EIA integration (eia.py):
- Add EIAClient for supplementary ERCOT data via EIA API
- Methods: get_demand(), get_generation(), get_generation_by_fuel()
- Useful for data before December 2023

Polling utilities (polling.py):
- Add ERCOTPoller class for continuous data monitoring
- Support callback and generator patterns
- Include exponential backoff and rate limit awareness

Documentation:
- Add API data availability constants and developer resource URLs
- Update CLAUDE.md with data availability limitations
- Update README.md and tinygrid/README.md with new features

Tests:
- Add comprehensive tests for all new modules
- Coverage increased from 79% to 95%
- 746 total tests (150 new tests added)
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 29, 2025

Codecov Report

❌ Patch coverage is 96.15385% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tinygrid/ercot/dashboard.py 89.65% 24 Missing ⚠️
tinygrid/ercot/client.py 97.77% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@kvkenyon
Copy link
Copy Markdown
Owner Author

@cursoragent Codecov Report
❌ Patch coverage is 91.23077% with 57 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tinygrid/ercot/dashboard.py 81.46% 43 Missing ⚠️
tinygrid/ercot/api.py 86.79% 7 Missing ⚠️
tinygrid/ercot/client.py 91.11% 4 Missing ⚠️
tinygrid/ercot/polling.py 96.84% 3 Missing ⚠️
📢 Thoughts on this report? codecov/feedback#255

@cursor
Copy link
Copy Markdown

cursor Bot commented Dec 29, 2025

All tests pass and coverage has improved. Here's a summary of what I've done:

Summary

I added comprehensive tests to improve code coverage for the 4 files flagged by Codecov:

1. tinygrid/ercot/dashboard.py (was 81.46%)

Added 40+ new tests covering:

  • Exception handling paths for all dashboard methods (get_status, get_fuel_mix, get_renewable_generation, get_supply_demand, get_daily_prices, get_system_wide_demand, get_energy_storage_resources, get_capacity_committed)
  • Failure cases (API unavailable, empty data, invalid data)
  • Alternative field name parsing in API responses
  • Non-normal grid conditions with message generation
  • Generic exception handling in _fetch_json

2. tinygrid/ercot/api.py (was 86.79%)

Added tests for:

  • Non-historical (live API) paths for wind and solar forecasts
  • All combinations of resolution ("hourly", "5min") and by_region parameters
  • Both historical and live endpoint routing

3. tinygrid/ercot/client.py (was 91.11%)

Added tests for:

  • Client initialization without authentication
  • Rate limiter enabled/disabled states
  • Various _products_to_dataframe input formats (raw list, HAL format, additional_properties)
  • Exception handling in _extract_response_data
  • Context manager usage
  • _should_use_historical method

4. tinygrid/ercot/polling.py (was 96.84%)

Added tests for:

  • Callback-based polling stopping on max errors
  • Explicit start argument handling
  • Early stopping via stop() method
  • Wait time calculations with backoff

Overall coverage improved from 91.23% to 96%, with all 806 tests passing.


Open in Cursor Open in Web

Learn more about Cursor Agents

Co-authored-by: kvkenyon <kvkenyon@utexas.edu>
@cursor
Copy link
Copy Markdown

cursor Bot commented Dec 29, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@kvkenyon kvkenyon merged commit 082c2c6 into main Dec 29, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants